package xyz.hubery.controller;

import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;
import xyz.hubery.model.BaseResult;
import xyz.hubery.service.AICustCareService;
import xyz.hubery.service.ShoppingUserService;

/**
 * AI客服
 */
@RestController
@RequestMapping("/user/custcare")
public class AICustCareController {
    @DubboReference(timeout = 30000) // 指定30秒超时
    private AICustCareService aiCustCareService;


    /**
     * 回答用户问题
     *
     * @param message 问题
     * @return 答案
     */
    @GetMapping("/answer")
    public BaseResult<String> answer(@RequestParam("message") String message, @RequestHeader Long userId) {
        String answer = aiCustCareService.generateResponse(message,userId);
        return BaseResult.ok(answer);
    }
}
